#coding=utf-8
'''
Created on 2012-6-28

@author: zhaojp
'''
from sqlite3 import connect;
from sqlite3 import PARSE_COLNAMES;
from datetime import date;

conn = connect('G:/workspace/other_programming_language_workspace/DjangoExample/sqlite.db', detect_types=PARSE_COLNAMES);
cur = conn.cursor();
cur.execute('delete from item_book');
cur.execute('insert into item_book(name,pub_date) values(?,?)', ('Python', date(2011, 1, 12)));
cur.execute('insert into item_book(name,pub_date) values(?,?)', ('Java core programming 8th', date(2012, 5, 30)));
cur.execute('insert into item_book(name,pub_date) values(?,?)', ('Think in Java 4th', date(2008, 2, 20)));
cur.execute('insert into item_book(name,pub_date) values(?,?)', ('Mongodb combat', date(2012, 3, 15)));
cur.execute('insert into item_book(name,pub_date) values(?,?)', ('JMS combat', date(2010, 7, 24)));
cur.execute('insert into item_book(name,pub_date) values(?,?)', ('Unix Shell tutorial', date(2009, 11, 10)));

item_books = cur.execute('select * from item_book');
for i, name, put_date in item_books:
    print i, name, put_date;
conn.commit();
conn.close();
